<?php

#重置商品库存
ini_set('display_errors', 1);
error_reporting(-1);
ini_set('memory_limit', '512M');
require_once '/data/wwwroot/g_vendor/autoload.php';

if(time() > \Biz\pockets\constInterface\SpringHomeDecConfig::ACTIVITY_TIME_START){
    echo "活动已开始禁止执行！！！\r\n";
    exit;
}

$where['status'] = \Biz\model\springHomeDecActivity\ActivityProduct::STATUS_NORMAL;
$products = \Biz\model\springHomeDecActivity\ActivityProduct::dataSelect($where);
foreach ($products as $product) {
    $updateData = [
        'num' => $product['total'],
        'v' => 0,
    ];
    $where['id'] = $product['id'];
    $where['product_id'] = $product['product_id'];

    $count = \Biz\model\springHomeDecActivity\ActivityProduct::dataUpdate($updateData, $where, true);

    var_dump($count, \Biz\model\springHomeDecActivity\ActivityProduct::log());

}